<?php

Class CBaseAdvertisementCategorie extends CBaseEosSingular {

	protected $m_intId;
	protected $m_strCategory;
	protected $m_boolIsActive;
	protected $m_intCreatedBy;
	protected $m_strCreatedOn;

	public function __construct() {
		parent::__construct();
		return true;
	}

	/**************************************
	************* SET FUNCTIONS ***********
	**************************************/

	public function setId( $intId ) {
		$this->m_intId = $intId;
	}
	public function setCategory( $strCategory ) {
		$this->m_strCategory = $strCategory;
	}
	public function setIsActive( $boolIsActive ) {
		$this->m_boolIsActive = $boolIsActive;
	}
	public function setCreatedBy( $intCreatedBy ) {
		$this->m_intCreatedBy = $intCreatedBy;
	}
	public function setCreatedOn( $strCreatedOn ) {
		$this->m_strCreatedOn = $strCreatedOn;
	}

	/**************************************
	************* GET FUNCTIONS ***********
	**************************************/

	public function getId() {
		return $this->m_intId;
	}
	public function getCategory() {
		return $this->m_strCategory;
	}
	public function getIsActive() {
		return $this->m_boolIsActive;
	}
	public function getCreatedBy() {
		return $this->m_intCreatedBy;
	}
	public function getCreatedOn() {
		return $this->m_strCreatedOn;
	}

	/*******************************************
	************* DATABASE FUNCTIONS ***********
	*******************************************/

	public function insert( $intUserId, $objDatabase ) {
		$strSql  = ' INSERT INTO `advertisement_categories` ( `category`,`is_active`,`created_by` )  VALUES (';
		$strSql .= ' \'' . $this->getCategory() . '\',';
		$strSql .= ' \'' . $this->getIsActive() . '\',';
		$strSql .= ' \'' . $intUserId . '\');';

		return parent::insertRecord( $strSql, $objDatabase );
	}

	public function update( $objDatabase ) {
		$strSql  = ' UPDATE `advertisement_categories` SET ';
		$strSql .= ' `category` = \'' . $this->getCategory() . '\',';
		$strSql .= ' `is_active` = \'' . $this->getIsActive() . '\'';
		$strSql .= ' WHERE `id` = ' . $this->getId() . ';';

		return parent::updateRecord( $strSql, $objDatabase );
	}

	public function delete( $objDatabase ) {
		$strSql  = ' DELETE FROM `advertisement_categories` WHERE `id` =' .  $this->getId();

		return parent::deleteRecord( $strSql, $objDatabase );
	}
}
?>